package com.doge.controller.wx;

import com.doge.bean.base.BaseData;
import com.doge.bean.base.BaseParam;
import com.doge.bean.base.BaseRespVo;
import com.doge.service.wx.footprint.WxFootprintService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("wx/footprint/")
public class WxFootprintController {
    @Autowired
    WxFootprintService wxFootprintService;
    /**
     * /wx/footprint/list?page=1&limit=10  GET
     */
    @GetMapping("list")
    public BaseRespVo listFootPrint(BaseParam baseParam){
        BaseData data = wxFootprintService.list(baseParam);
        return BaseRespVo.ok(data);
    }
    /**
     * /wx/footprint/delete  POST
     * {id: 327}
     * 需要双击历史足迹才能触发删除历史足迹的按钮
     */
    @PostMapping("delete")
    public BaseRespVo delete(@RequestBody Map map){
        Integer id = (Integer) map.get("id");
        int rows = wxFootprintService.delete(id);
        return BaseRespVo.ok(null);
    }
}